package com.tomcov.client;

import com.google.gwt.activity.shared.Activity;
import com.google.gwt.activity.shared.ActivityMapper;
import com.google.gwt.place.shared.Place;
import com.tomcov.client.activities.CreatUserActivity;
import com.tomcov.client.activities.LicenceActivity;
import com.tomcov.client.activities.MapActivity;
import com.tomcov.client.activities.MessageInActivity;
import com.tomcov.client.activities.MessageOutActivity;
import com.tomcov.client.activities.MyJourneyActivity;
import com.tomcov.client.activities.NewMessageActivity;
import com.tomcov.client.activities.SettingsActivity;
import com.tomcov.client.activities.WelcomActivity;
import com.tomcov.client.place.CreatUserPlace;
import com.tomcov.client.place.LicencePlace;
import com.tomcov.client.place.MapPlace;
import com.tomcov.client.place.MessageInPlace;
import com.tomcov.client.place.MessageOutPlace;
import com.tomcov.client.place.MyJourneyPlace;
import com.tomcov.client.place.NewMessagePlace;
import com.tomcov.client.place.SettingsPlace;
import com.tomcov.client.place.WelcomPlace;

// TODO: Auto-generated Javadoc
/**
 * The Class MainAppActivityMapper.
 */
public class MainAppActivityMapper implements ActivityMapper {
    
    /** The client factory. */
    private ClientFactory clientFactory;

    /**
     * Instantiates a new main app activity mapper.
     *
     * @param clientFactory the client factory
     */
    public MainAppActivityMapper(ClientFactory clientFactory) {
        //super();
        this.clientFactory = clientFactory;
    }

    /* (non-Javadoc)
     * @see com.google.gwt.activity.shared.ActivityMapper#getActivity(com.google.gwt.place.shared.Place)
     */
    @Override
    public Activity getActivity(Place place) {
        if (place instanceof WelcomPlace)
            return new WelcomActivity(clientFactory);
        else if (place instanceof MapPlace)
            return new MapActivity(clientFactory);
        else if (place instanceof CreatUserPlace)
            return new CreatUserActivity(clientFactory);
        else if (place instanceof LicencePlace)
            return new LicenceActivity(clientFactory);
        else if (place instanceof MessageOutPlace)
            return new MessageOutActivity(clientFactory);
        else if (place instanceof MessageInPlace)
            return new MessageInActivity(clientFactory);
        else if (place instanceof SettingsPlace)
            return new SettingsActivity(clientFactory);
        else if (place instanceof NewMessagePlace)
            return new NewMessageActivity(clientFactory);
        else if (place instanceof MyJourneyPlace)
            return new MyJourneyActivity(clientFactory);
        return null;
    }
}
